-- die_skill
-- created by zhuangsl
-- 死亡触发技能

return {
    apply = function(prop, baseValue)
        return prop[3];
    end,
    -- 触发
    trigger = function(who, prop, arg)
        if who.type ~= OBJECT_TYPE_USER then
            return;
        end

        -- 不满足概率
        if DungeonM.getRandSeed("die_skill") % 1000 >= prop[3] then
            return;
        end

        -- 先把触发技能缓存起来
        SkillM.skillTriggerCache(who, tonumber(prop[2]));
    end,

    desc = function(prop)
        local row = PropM.getRow(prop[1]);
        local desc = row.desc;
        local skillName = SkillM.query(tonumber(prop[2]), "name");

        desc = string.gsub(desc, "{0}", skillName);

        return string.gsub(desc, "{1}", tonumber(prop[3] / 10));
    end,

    record = function(target, prop, path)
        return false;
    end
};
